
var cols:int = 4;
var rows:int =4;
var totalCards:int =16;
var cardW:int = 43;
var cardH:int = 54;

var aCards:Array;
var aGrid:Array;
var aCardFlipped:ArrayList;


function Start()
{
	Debug.Log("GameStart");
	aCards = new Array();
	aGrid = new Array();
	aCardFlipped = new ArrayList();
	
	for( i=0 ; i<rows ; i++)
	{
		aGrid[i] = new Array();
		for(j=0 ; j<cols; j++)
		{
			aGrid[i][j] = new Card(i+j+1,(i+j)%4+1 );
		}
	}
		
}

function OnGUI()
{
	GUILayout.BeginArea( Rect(0,0,Screen.width,Screen.height));
	BuildGrid();
	GUILayout.EndArea();	
}

function BuildGrid()
{

	GUILayout.BeginVertical();
	for(i=0 ; i<rows;i++)
	{
		GUILayout.BeginHorizontal();
		for(j=0;j<cols;j++)
		{
			var card:Object = aGrid[i][j];
			if(GUILayout.Button(Resources.Load(card.img),GUILayout.Width(cardW)))
			{
			}
			
			
		}
		GUILayout.EndHorizontal();
	}
	GUILayout.EndVertical();
}